
const chokidar = require('chokidar');
const shelljs = require('shelljs');
const http = require('http');

const sockjs = require('sockjs');
const node_static = require('node-static');
var echo = sockjs.createServer({ sockjs_url: 'http://cdn.jsdelivr.net/sockjs/1.0.1/sockjs.min.js' });
echo.on('connection', function(conn) {

    conn.on('data', function(message) {
        // conn.write("123123123");
    });
    conn.on('close', function() {});
});

var server = http.createServer();
echo.installHandlers(server, {prefix:'/echo'});
server.listen(9999, '0.0.0.0');
chokidar.watch('./component').on('change', function(){

    shelljs.exec("node parseJS.js");
    // conn.write(JSON.stringify({"type":"file-update"}));
    // shelljs.exec("node watch.js");
});